package com.zz.parkingsystem.service.impl;

import com.zz.parkingsystem.dto.PdaDTO;
import com.zz.parkingsystem.entity.Pda;
import com.zz.parkingsystem.mapper.PdaMapper;
import com.zz.parkingsystem.service.PCPdaService;
import com.zz.parkingsystem.vo.AllPdaVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class PCPdaServiceImpl implements PCPdaService {
    @Resource
    private PdaMapper pdaMapper;

    @Override
    public Long getCount(PdaDTO pdaDto) {
        return pdaMapper.getCount(pdaDto);
    }

    @Override
    public List<AllPdaVO> getAllPda(PdaDTO pdaDto) {
        return pdaMapper.getAllPda(pdaDto);
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        Pda pda = pdaMapper.selectByPrimaryKey(id);
        if(pda!=null){
            int i = pdaMapper.deleteByPrimaryKey(id);
            return i;
        }else {
            return 0;
        }
    }

    @Override
    public int insertSelective(Pda record) {
        return pdaMapper.insertSelective(record);
    }

    @Override
    public Pda selectByPrimaryKey(Long id) {
        return pdaMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Pda record) {
        return pdaMapper.updateByPrimaryKeySelective(record);
    }
}
